package com.css.service.impl;

import java.util.List;

import com.css.dao.ICarDAO;
import com.css.service.ICarService;
import com.css.vo.Car;

public class CarService implements ICarService {

	private ICarDAO carDAO;

	public void setCarDAO(ICarDAO carDAO) {
		this.carDAO = carDAO;
	}

	@Override
	public void save(Car car) {
		carDAO.save(car);
	}

	@Override
	public void delete(Car car) {
		carDAO.delete(car);
	}

	@Override
	public void update(Car car) {
		carDAO.update(car);
	}

	@Override
	public Car find(String carModel) {
		return carDAO.find(carModel);
	}

	@Override
	public List<Car> findAllCar() {
		List list = carDAO.findAllCar();
		return list;
	}

	@Override
	public Car findById(Integer id) {
		List<Car> list = carDAO.findById(id);
		Car car = list.get(0);
		return car;
	}

	@Override
	public List<Car> searchCar(String keyword) {
		return carDAO.searchCar(keyword);
	}

}
